import ddt
import time
import unittest
from selenium import webdriver
from a2022.unittest.maths import *

"""
    自定义加减乘除
"""


@ddt.ddt()  # 装饰类，被ddt装饰的类可以直接使用ddt
class Adddemo(unittest.TestCase):
    # def setUp(self):
    #     print("测试用例执行前环境准备")
    #
    # def tearDown(self):
    #     print("测试用例执行后环境清理")
    # # 单组参数
    # @ddt.data(1,2,3,4) #    装饰方法,测试4个数据
    # def test_data_1(self,value):
    #     print("单组参数测试")
    #     self.assertEqual(3,value)
    # #   多组参数未分解
    # @ddt.data((1,2,3),(3,2,1))
    # def test_data_2(self,value):
    #     print("多种参数未分解")
    #     print(value)
    #     self.assertEqual((1,2,3),value)
    # #   多组数据,使用unpack装饰器进行拆分
    # @ddt.data((1,2,3),("he","llo","hello"))
    # @ddt.unpack
    # def test_data_3(self,x,y,z):
    #     print("x={},y={},z={}".format(x,y,z))
    #     self.assertEqual(add(x,y),z)
    #   字典测试,键值对
    @ddt.data({"name": "chen", "age": 20},
              {"name": "li", "age": 19})
    @ddt.unpack
    def test_data_4(self, name, age):
        print(name, age)


if __name__ == '__main__':
    unittest.main()
